package com.twu.biblioteca;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.List;

/**
* Created by archoud on 3/5/14.
*/
public class Output {
    PrintStream printStream;

    public Output(PrintStream printStream) {
        this.printStream = printStream;
    }

    public void print(String msg) {
        printStream.print(msg);
    }

    public void printList(String header, List list){
        String result = "\n\n" + header + "\n\n";
        for (int i = 0; i < list.size(); i++) {
            String text = list.get(i).toString();
            int numeral = i + 1;
            result += numeral + ". " + text + "\n";
        }
        printStream.print(result);
    }
}
